package com.nulldev.util.security.hashAPI.impls.keccak;

import com.nulldev.util.security.hashAPI.Hashable;

public class SHAKE implements Hashable<byte[]> {
	private static final int DEFAULT_DIGEST_SIZE = 256;

	@Override
	public byte[] hash(byte[] data) {
		final com.nulldev.util.security.hashAPI.impls.keccak.impl.SHAKE k = new com.nulldev.util.security.hashAPI.impls.keccak.impl.SHAKE(DEFAULT_DIGEST_SIZE);
		k.update(data);
		return k.digestArray();
	}

	@Override
	public byte[] raw_hash(byte[] data) {
		final com.nulldev.util.security.hashAPI.impls.keccak.impl.SHAKE k = new com.nulldev.util.security.hashAPI.impls.keccak.impl.SHAKE(DEFAULT_DIGEST_SIZE);
		k.update(data);
		return k.digestArray();
	}

	@Override
	public String id() {
		return "native.shake";
	}

	@Override
	public String[] hashes() {
		return new String[]
			{ "SHAKE", "Shake", "shake" };
	}

	@Override
	public Hashable<?> clone() {
		return this;
	}

}
